|
|
|
|
|
|
|
Figure 15.5
The new control is
displayed as an
icon in the
Toolbox window. |
|
|
|
|
|
|
|
|
As you can see, the custom control that you created and added to the project in an earlier lesson and the SysTray control both have the same icon. This is because neither you nor the person who created the SysTray control set the ToolBoxBitmap property for the control. If you want, you can change this property yourself to make it easier for you to identify which control is which. Close any open form or code window, and then open the frmMain form. Place the SysTray control on the form and set the properties listed in Table 15.9. |
|
|
|
|
| TABLE 15.9. THE PROPERTY SETTINGS FOR THE SYSTRAY CONTROL. | | Property | Value | | Name | sysAdTray | | InTray | True | | ToolTip | Address Book Application | | TrayIcon | Set to any valid bitmap that you want to use |
|
|
|
|
|
|
For this to work with the address book, you need to add a new item to the main menu to allow users to hide the application when it's not being used. You also will need to add the code to redisplay the application when users double-click the associated tray icon. You can use the following code line in both places because it toggles the form's Visible property from True to False: |
|
|
|
|
|
|
|
|
Me.Visible = Not Me.Visible |
|
|
|
|
|
|
|
|
The one problem when using the system tray control is that if you use an Unload or End statement to end the application, the application terminates abnormally. For the system tray control to work properly, you need to add two Windows API definitions to the |
|
|
|
|
|